package com.zkingsoft.actions.visitor;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zkingsoft.actions.common.BaseController;
import com.zkingsoft.model.Article;
import com.zkingsoft.pojo.AjaxResult;
import com.zkingsoft.services.ArticleService;

/**
 * @author dingchuan
 * @date 2016-07-15 11:19
 * 文章Controller
 */
@Controller
@RequestMapping(value = "visitor/article")
public class ArticleServiceController extends BaseController{

	@Resource
	private ArticleService currentService;

	
	@RequestMapping(value = "/findByName")
	private @ResponseBody AjaxResult findByName(Article article){
		AjaxResult	result=  new AjaxResult();
		List<Article> artList=currentService.findByModel(article);
		if(artList.size()==1){
			article=artList.get(0);
			result.putInMap("art", article);
		}
		result.setStatus(AjaxResult.STATUS_OK);
		 return result;
	}
 	
}